package com.XinYun.Library.modules.Login.Service.Impl;

import com.XinYun.Library.modules.Login.Dao.Impl.MemberDaoImpl;
import com.XinYun.Library.modules.Login.Entity.Admin;
import com.XinYun.Library.modules.Login.Service.MemberService;

public class MemberServiceImpl implements MemberService {
    MemberDaoImpl memberDao =  new MemberDaoImpl();

    /**
     * 判断能否登录成功
     * @param sid
     * @param password
     * @return
     */
    @Override
    public boolean isLogin(String sid, String password) {
        try {
            String pwd = memberDao.queryPwd(sid);
            if(password.equals(pwd)){
                return true;
            }
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
        return false;
    }

    /**
     * 判断用户是否存在，用于判断学号是否在数据库里面
     * @param sid
     * @return
     * @throws Exception
     */
    @Override
    public boolean isExist(String sid) throws Exception {
        int id = memberDao.queryId(sid);
        if(id != 0){
            return true;
        }
        return false;
    }

}
